import threading


# 任务函数
def task(name, age):
    print("测试")
    # 获取当前执行代码的线程
    task_thread = threading.current_thread()
    print("task:", task_thread)
    # name, age
    print("姓名:%s 年龄:%d" % (name, age))


if __name__ == '__main__':

    # 获取当前执行代码的线程
    main_thread = threading.current_thread()
    print("main:", main_thread)
    # # 创建子线程
    # sub_thread = threading.Thread(target=task, args=("李四", 20))
    # # 启动线程执行任务
    # sub_thread.start()

    # 创建子线程
    sub_thread = threading.Thread(target=task, kwargs={"name": "貂蝉", "age": 18})
    # 启动线程执行任务
    sub_thread.start()